<template>
  <div class="App">
    <h2 class="content">我是app组件</h2>
    <p>{{count}}</p>
    <Count :count="count" :changeCount="changeCount"></Count>
  </div>
</template>

<script>
import Count from "@/components/Count";

export default {
  name: 'App',
  components: {
    Count,
  },
  data(){
    return{
      count:0,
    }
  },
  methods:{
  //父组件传递方法在子组件中使用来改变父组件中data中的数据
    changeCount(n){
      this.count += n;
    }
  }
}
</script>
